package basic.socket.udp;

import java.net.DatagramPacket;
import java.net.DatagramSocket;

/**
 * @author bingo
 * @Description
 * @Date 2018/7/18
 */
public class DatagramSocketServer {

    public static void main(String[] args) throws  Exception {
        DatagramSocket ds = new DatagramSocket(8887);
        byte[]  bys = new byte[1024];

        DatagramPacket dp = new DatagramPacket(bys,bys.length);

        ds.receive(dp);

        String info = new String(dp.getData());

        System.out.println(dp.getAddress().getHostAddress()+"发送的数据为"+info);






    }
}
